package com.propic.www;

import javafx.scene.image.*;
import javafx.scene.paint.Color;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by geange on 16-4-19.
 */
public class ScanPixel {

    public static List<Color> colors = new ArrayList<>();

    public int setBordercolor(Image image){

        PixelReader pixelReader = image.getPixelReader();

        int height = (int)image.getHeight();
        int weight = (int)image.getWidth();

        for(int y = 0; y<4; y++){
            for (int x = 0; x<weight; x++){
                Color colortmp = pixelReader.getColor(x, y);
                colors.add(colortmp);
            }
        }

        for (int y = height-4; y < height; y++){
            for (int x = 0; x<weight; x++){
                Color colortmp = pixelReader.getColor(x, y);
                colors.add(colortmp);
            }
        }

        for (int y = 0; y<height; y++){
            for (int x = 0; x<4; x++){
                Color colortmp = pixelReader.getColor(x, y);
                colors.add(colortmp);
            }
        }

        for (int y = 0; y<height; y++){
            for (int x = weight-4; x<weight; x++){
                Color colortmp = pixelReader.getColor(x, y);
                colors.add(colortmp);
            }
        }

        for (Color in : colors){
            int green = (int)in.getGreen();
        }



        return 0;
    }
}
